{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "71a32670",
   "metadata": {},
   "source": [
    "## 元组（tuple）\n",
    "* [元组](https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences)\n",
    "1. 它是和list几乎完全一样的序列数据\n",
    "2. 它与list的区别在于 **不可变**（因为不可变,所以几乎无方法）\n",
    "3. 元组的形式：(1,2,3,4,5) 对比 元组() 列表[]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "97844dac",
   "metadata": {},
   "source": [
    "## 字典\n",
    "创建字典的三种常见方法\n",
    "1. 直接按照字典的格式创建：{key1:value1,key2:value2,....}\n",
    "2. dict()函数创建字典：dict(key1=value1,key2=value2,....)\n",
    "3. 字典数据增加的方式：新建空字典dict_name = {},dict_name[key1]=value1..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "77b2cd25",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-25T08:41:39.172168Z",
     "start_time": "2021-10-25T08:41:39.155167Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stud_1001': 'Alex', 'stud_1002': 'Mike', 'stud_1003': 'Pina'}"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1. 直接按照字典的格式创建：{key1:value1,key2:value2,....}\n",
    "stud_info = {\n",
    "    \"stud_1001\":\"Alex\",\n",
    "    \"stud_1002\":\"Mike\",\n",
    "    \"stud_1003\":\"Pina\"\n",
    "}\n",
    "stud_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "bef5bf42",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-25T08:45:35.224710Z",
     "start_time": "2021-10-25T08:45:35.210709Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stud_1001': 'Alex', 'stud_1002': 'Mike', 'stud_1003': 'Pina'}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 2. dict()函数创建字典：dict(key1=value1,key2=value2,....)\n",
    "stud_info_02 = dict(\n",
    "    stud_1001 = \"Alex\",\n",
    "    stud_1002 = \"Mike\",\n",
    "    stud_1003 = \"Pina\"\n",
    ")\n",
    "stud_info_02"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "11f6c69a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-10-25T17:01:00.618200Z",
     "start_time": "2021-10-25T17:01:00.604200Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stud_1001': 'Alex', 'stud_1002': 'Mike', 'stud_1003': 'Pina'}"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stud_info_03 = {}\n",
    "stud_info_03[\"stud_1001\"] = \"Alex\"\n",
    "stud_info_03[\"stud_1002\"] = \"Mike\"\n",
    "stud_info_03[\"stud_1003\"] = \"Pina\"\n",
    "stud_info_03"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "74a8afed",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
